Skip to content

fix: Implement correct balance updating logic#4692

Open
JonathanOppenheimer wants to merge 18 commits intomasterfrom
JonathanOppenheimer/validate-balance-change
Open

fix: Implement correct balance updating logic#4692
JonathanOppenheimer wants to merge 18 commits intomasterfrom
JonathanOppenheimer/validate-balance-change

Conversation

@JonathanOppenheimer
Copy link
Copy Markdown
Contributor

Why this should be merged

Previously upgradeAccount would naively assume that any upgrade.BalanceChange was positive, even though the underlying BalanceChange was a Big.Int, which can be negative. This meant that negative balance updates would be interpreted as positive updates, which is strange, and arguably incorrect behavior. This PR correctly implements the balance changing behavior, and adds checks to ensure account balances are not updated to non-sensical values. Closes #4719

How this was tested

I added a new test file, state_upgrade_test.go. This behavior was seemingly not tested prior.

Need to be documented?

I don't think so - we are not exposing any additional API methods, we're just fixing an existing one.

Need to update RELEASES.md?

No

JonathanOppenheimer and others added 11 commits December 15, 2025 12:34
Co-authored-by: Austin Larson <78000745+alarso16@users.noreply.github.com>
Signed-off-by: Jonathan Oppenheimer <147infiniti@gmail.com>
Co-authored-by: Austin Larson <78000745+alarso16@users.noreply.github.com>
Signed-off-by: Jonathan Oppenheimer <147infiniti@gmail.com>
@JonathanOppenheimer JonathanOppenheimer self-assigned this Dec 15, 2025
@JonathanOppenheimer JonathanOppenheimer requested a review from a team as a code owner December 15, 2025 17:36
@JonathanOppenheimer JonathanOppenheimer added the bug Something isn't working label Dec 15, 2025
@JonathanOppenheimer
Copy link
Copy Markdown
Contributor Author

Relevant comment: ava-labs/subnet-evm#1745 (comment)

@JonathanOppenheimer JonathanOppenheimer added evm Related to EVM functionality subnet-evm Related to the former subnet-evm standalone repository labels Dec 15, 2025
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Mar 1, 2026

This PR has become stale because it has been open for 30 days with no activity. Adding the lifecycle/frozen label will cause this PR to ignore lifecycle events.

@github-actions
Copy link
Copy Markdown

This PR has become stale because it has been open for 30 days with no activity. Adding the lifecycle/frozen label will cause this PR to ignore lifecycle events.

@github-actions github-actions Bot added the lifecycle/stale Inactive for 60 days label Apr 12, 2026
@JonathanOppenheimer JonathanOppenheimer removed the lifecycle/stale Inactive for 60 days label Apr 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working evm Related to EVM functionality subnet-evm Related to the former subnet-evm standalone repository

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Additional State Upgrade Config Validation

1 participant